<?php
/**
 *
 * @author Strawberry🍓
 * @date 2021-05-21 4:08 下午
 *
 */

namespace app\common\model\tang;


use app\common\impl\Comm;
use app\common\model\CommonBaseModel;
use Jrk\Tree;

class FloorConfig extends CommonBaseModel implements Comm
{

    public function getAdminPageData($param = [], $order = 'id desc')
    {
        // TODO: Implement getAdminPageData() method.
        $where=[];
        if (isset($param['name']) && $param['name']) {
            $where[] = ['name','like',"%{$param['name']}%"];
        }
        $data = self::where($where)->order($order)->page(PAGE)->limit(LIMIT)->select()->toArray();
        $count = self::where($where)->count("id");
        $releaseModel = new ReleaseUser();
        foreach ($data as $k=>$v){
            if(!empty($v['principal'])){
                $data[$k]['zhu_name'] = $releaseModel->where('id',$v['principal'])->value('name');
            }else{
                $data[$k]['zhu_name'] = '暂无配置';
            }
            if(!empty($v['principal_fu'])){
                $data[$k]['ci_name'] = $releaseModel->where('id',$v['principal'])->value('name');
            }else{
                $data[$k]['ci_name'] = '暂无配置';
            }
        }
        return parent::ajaxResult($data, $count);

    }

    public function delById($id)
    {
        // TODO: Implement delById() method.
    }

    public function doAll($data)
    {
        // TODO: Implement doAll() method.
        return parent::doAllData($data);
    }
}